<?php
require './configs/config.php';




// require './models/Model.class.php';
// require './controllers/GoodsController.class.php';
// require './controllers/IndexController.class.php';
// require './controllers/UserController.class.php';

require './libs/Smarty.class.php';

spl_autoload_register('mvc_autoload');

function mvc_autoload($classname){
 	if(file_exists("./models/{$classname}.class.php")){
 		require "./models/{$classname}.class.php";
 	} else if (file_exists("./controllers/{$classname}.class.php")) {
 		require "./controllers/{$classname}.class.php";
 	} else {
 		header("HTTP/1.0 404 not found");
 		echo '<h1>404 NOT FOUND</h1>入口文件';
 		exit;

 	}
}

// $smarty = new Smarty();




$c = (!empty($_GET['c']))?$_GET['c']:'Index';

$a = (!empty($_GET['a']))?$_GET['a']:'index';


//拼装类名
$classname = $c.'Controller';

//实例化控制器
$controller = new $classname();


//调用控制器中的方法
$controller->$a();












